From: Jonas Dreßler Date: Sun, 16 Feb 2020 22:03:14 +0000 (+0100) Subject: userWidget: Simplify icon size setting a bit X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~772^2^2~109 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=38b38732d3c744cc25f7270c7e22946e6da8d19a;p=gnome-shell.git userWidget: Simplify icon size setting a bit Remove the default icon size of -1 and always set the container StBin to a real size. This fixes an error where the "width" and "height" properties get set to -2 (which is -1 * scaleFactor) in the `_init` function. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1018 --- diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js index e5f788338..d749ceebe 100644 --- a/js/ui/userWidget.js +++ b/js/ui/userWidget.js @@ -7,7 +7,6 @@ const { Clutter, GLib, GObject, St } = imports.gi; const Params = imports.misc.params; -const UNKNOWN_AVATAR_ICON_SIZE = -1; var AVATAR_ICON_SIZE = 64; // Adapted from gdm/gui/user-switch-applet/applet.c @@ -22,7 +21,7 @@ class Avatar extends St.Bin { params = Params.parse(params, { styleClass: 'user-icon', reactive: false, - iconSize: UNKNOWN_AVATAR_ICON_SIZE, + iconSize: AVATAR_ICON_SIZE, }); super._init({ @@ -72,20 +71,11 @@ class Avatar extends St.Bin { } } - _getIconSize() { - if (this._iconSize !== UNKNOWN_AVATAR_ICON_SIZE) - return this._iconSize; - else - return AVATAR_ICON_SIZE; - } - setSensitive(sensitive) { this.reactive = sensitive; } update() { - let iconSize = this._getIconSize(); - let iconFile = null; if (this._user) { iconFile = this._user.get_icon_file(); @@ -98,8 +88,8 @@ class Avatar extends St.Bin { let { scaleFactor } = St.ThemeContext.get_for_stage(global.stage); this.set_size( - iconSize * scaleFactor, - iconSize * scaleFactor); + this._iconSize * scaleFactor, + this._iconSize * scaleFactor); this.style = ` background-image: url("${iconFile}"); background-size: cover;`; @@ -107,7 +97,7 @@ class Avatar extends St.Bin { this.style = null; this.child = new St.Icon({ icon_name: 'avatar-default-symbolic', - icon_size: iconSize, + icon_size: this._iconSize, }); } }